<template>
  <div class="pdf-viewer">
    <iframe :src="frameUrl"
            width="100%"
            height="100%"></iframe>
  </div>
</template>
<script>
export default {
  data() {
    return {
        // pdfurl: 'https://cdn.shhzcj.com/uploads/adInfo/6377279ac56d2.pdf',
      pdfurl:
        'https://chcms.xinxinqushi.com/wxhelp/6cbe14c7-d1c3-460a-aa8d-94056584d2c31672999809371.pdf',
    }
  },
  methods: {},
  created() {},
  mounted() {
    let { url } = this.$route.query
    // 获取预览文件的完整接口地址，根据具体情况编写，反正path就是一个预览文件的接口地址
    // const path = this.$api.filePreview(id)
    // const url =
    //   'https%3A%2F%2Fchcms.xinxinqushi.com%2Fwxhelp%2F7292e3ab-4bdc-4f40-813f-8657e78035581675310603630.pdf'
    // let path = 'http://14.1.1.1:8088/file/downloadFile?id=140'
    if (url) {
        this.pdfurl=url
    }
    
  },
  computed: {
   frameUrl(){
      const fileUrl = '/dawn-viewer/web/viewer.html'
      return  fileUrl + '?file=' + decodeURIComponent(this.pdfurl)
    }
  },
}
</script>
<style lang="scss" scoped>
.pdf-viewer {
  height: 100vh;
}
</style>
